package pl.edu.pk.mech.kkbus.service;

import static pl.edu.pk.mech.kkbus.staticstrings.NameEntity.NAME_ENTITY_DEFECTS;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import pl.edu.pk.mech.kkbus.model.Defect;
import pl.edu.pk.mech.kkbus.repository.DefectDAO;

public class DefectService {
    @Autowired
    DefectDAO defectDAO;
    
    public boolean createOrUpdateDefect(Defect defect) {
    	return defectDAO.createOrUpdate(defect, NAME_ENTITY_DEFECTS, defectDAO);
    }
    
    public List<Defect> getAllDefects() {
        return defectDAO.getAllDefects();
    }  
    
    public Defect getDefect(long id){
    	return defectDAO.getDefect(id);
    }
    
    public List<Defect> getDefectsByIdBus(String idBus) {
        return defectDAO.getDefectsByIdBus(idBus);
    }  
}
